import axios from '@/utils/axios'

export const getUser = (id: string): Promise<ApiResult<BaseUserPO>> => {
  return axios.get(`base/user/${id}`)
}

export const getUserPage = (
  pagination: Pagination,
  params: BaseUserPO
): Promise<ApiResult<Page<BaseUserPO>>> => {
  return axios.get(`base/user/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const postOrPutUser = (user: BaseUserPO): Promise<ApiResult<null>> => {
  return axios.post(`base/user`, user)
}

export const deleteUser = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`base/user/${id}`)
}

export const putPassword = (passwordDto: PasswordDto): Promise<ApiResult<null>> => {
  return axios.put(`base/user/password`, passwordDto)
}

export const resetPassword = (id: string): Promise<ApiResult<null>> => {
  return axios.put(`base/user/password/reset/${id}`)
}
